package wang.aweb.childcar.config;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource;
import wang.aweb.childcar.filter.AdminFilter;

@Configuration
public class AdminFilterConfig {
    @Bean
    public AdminFilter adminFilter(){return new AdminFilter();}

    @Bean(name="adminFilterConf")
    public FilterRegistrationBean agentFilterConfig(){
        FilterRegistrationBean filterRegistrationBean=new FilterRegistrationBean();
        filterRegistrationBean.setFilter(adminFilter());
        filterRegistrationBean.addUrlPatterns("/management/*");
        filterRegistrationBean.setName("adminFilterConf");
        return  filterRegistrationBean;
    }
}
